package com.content.view.Frame.MainPanel.MPUserInfo
{
	import com.content.model.LoadedAssets.SkinProxy;
	import com.content.model.OnlineRes.UserVO;
	import com.content.view.Frame.MainPanel.MPBase;
	import com.library.core.IDisposable;
	import com.library.core.UIObject;
	import com.library.utils.Geometry;
	
	import flash.display.BitmapData;
	import flash.display.Loader;
	import flash.display.MovieClip;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.DataEvent;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Matrix;
	import flash.net.URLRequest;
	import flash.text.TextField;
	
	import gs.TweenLite;
	import gs.easing.Cubic;
	
	public final class MPUserInfo extends MPBase
	{
		private var _vo:UserVO;
		private var _formMC:Sprite;
		private var _photoLo:Loader;
		
		public function MPUserInfo(	marginTop:int,
									marginBottom:int,
									marginLeft:int,
									marginRight:int,
									cBarWidth:int, 
									bgSkin:Sprite = null)
		{
			super(	
				this,
				marginTop,
				marginBottom,
				marginLeft,
				marginRight,
				cBarWidth, 
				bgSkin);
			
			_vo = new UserVO();
			_formMC = new SkinProxy.IMG_MPUserInfo_FormBG() as Sprite;
			_container.addChild(_formMC);
			
			_photoLo = new Loader();
			_formMC.addChild(_photoLo);
		}
		override protected function SetLayoutMP(areaWidth:int, areaHeight:int):void{
			_formMC.x = int((areaWidth - _formMC.width)/2);
			_formMC.y = int((areaHeight - _formMC.height)/2);
			
			_photoLo.x = 11;
			_photoLo.y = 10;
		}
		
		/* Public Method
		* ---------------------------------------------------- */
		public function UpdateInfo(xml:XML):void{
			var cmdName:String = xml.head.command;
			
			_vo.Number = xml.body.personal.base.info.(@id == "number");
			_vo.Fullname = xml.body.personal.base.info.(@id == "fullname");
			_vo.Gender = xml.body.personal.base.info.(@id == "gender");
			_vo.Birthday = xml.body.personal.base.info.(@id == "birthday");
			_vo.Nationality = xml.body.personal.base.info.(@id == "nationality");
			_vo.School = xml.body.personal.base.info.(@id == "school");
			_vo.SchoolAddress = xml.body.personal.base.info.(@id == "schooladdress");
			_vo.Class = xml.body.personal.base.info.(@id == "class");
			_vo.RegisterDate = xml.body.personal.base.info.(@id == "registerdate");
			_vo.Photo = xml.body.personal.base.info.(@id == "photo");
			
			TextField(_formMC["txtNumber"]).embedFonts = false;
			TextField(_formMC["txtFullname"]).embedFonts = false;
			TextField(_formMC["txtGender"]).embedFonts = false;
			TextField(_formMC["txtBirthday"]).embedFonts = false;
			TextField(_formMC["txtNationality"]).embedFonts = false;
			TextField(_formMC["txtSchool"]).embedFonts = false;
			TextField(_formMC["txtSchoolAddress"]).embedFonts = false;
			TextField(_formMC["txtClass"]).embedFonts = false;
			TextField(_formMC["txtRegisterDate"]).embedFonts = false;
			
			TextField(_formMC["txtNumber"]).text = _vo.Number;
			_formMC["txtFullname"].text = _vo.Fullname;
			_formMC["txtGender"].text = _vo.Gender;
			_formMC["txtBirthday"].text = _vo.Birthday;
			_formMC["txtNationality"].text = _vo.Nationality;
			_formMC["txtSchool"].text = _vo.School;
			_formMC["txtSchoolAddress"].text = _vo.SchoolAddress;
			_formMC["txtClass"].text = _vo.Class;
			_formMC["txtRegisterDate"].text = _vo.RegisterDate;
			
			_photoLo.load(new URLRequest(_vo.Photo));
		}
		
		override public function Dispose():void
		{
		}
	}
}